package com.shopping_back.mapper;

import com.shopping_back.pojo.dto.CartItemDTO;
import com.shopping_back.pojo.entity.CartItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * <p>
 * 购物车商品表 Mapper 接口
 * </p>
 *
 * @author Jack
 * @since 2025-07-12
 */
@Mapper
public interface CartItemMapper extends BaseMapper<CartItem> {
    List<CartItemDTO> selectCartItemsWithProduct(Long userId);
    @Select("SELECT * FROM cart_item WHERE user_id = #{userId} AND sku_id = #{productId}")
    CartItem selectByUserAndProduct(@Param("userId") Long userId, @Param("productId") Long productId);
}
